using System;
using System.Runtime.CompilerServices;

namespace Beetle;

public class DetectTimeoutHandler : Task
{
	private new OnlineSegment a = new OnlineSegment(TcpUtils.Connections * 2);

	[CompilerGenerated]
	private TcpServer b;

	public TcpServer Server
	{
		[CompilerGenerated]
		get
		{
			return b;
		}
		[CompilerGenerated]
		internal set
		{
			b = value;
		}
	}

	protected override void Execute()
	{
		if (Server != null && Server.IsRunning)
		{
			int tickCount = Environment.TickCount;
			Server.GetOnlines(a);
			for (int i = 0; i < a.Count; i++)
			{
				if (tickCount - a.Channels[i].TickCount >= TcpUtils.TimeOutms)
				{
					((aq)a.Channels[i]).j = "Request Timeout!";
					a.Channels[i].Dispose();
				}
			}
		}
		else
		{
			Dispose();
		}
	}
}
